<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://java.sun.com/jsf/facelets"
   xmlns:f="http://java.sun.com/jsf/core"
   xmlns:h="http://java.sun.com/jsf/html"
   xmlns:c="http://java.sun.com/jsp/jstl/core"
   xmlns:p="http://primefaces.org/ui"
   xmlns:our="http://java.sun.com/jsf/composite/components/grid">

	<ui:composition template="/admin.xhtml">
   		<ui:define name="page.title">
      		#{msg['neighborhood.register.title']}
   		</ui:define>
   		<f:metadata name="metadata">
      		<f:viewParam name="searchType" value="#{neighborhood.searchType}" />
      		<f:viewParam name="neighborhood" value="#{neighborhood.current}" converter="neighborhoodConverter" />
   		</f:metadata>

   <ui:define name="admin.content">
      <p:spacer height="10" />

      <h:form id="crud" prependId="false">
         <p:panel header="#{msg['neighborhood.register.title']}"
            toggleable="true" toggleSpeed="100"
            toggleTitle="#{msg['neighborhood.register.title']}">

            <p:messages />

            <h:panelGrid columns="3">
               <h:outputLabel value="#{msg['neighborhood.register.label.code']}" />
               <p:spacer width="10" />
               <p:inputText id="code"
                     value="#{neighborhood.current.code}"/>
               
               <h:outputLabel value="#{msg['neighborhood.register.label.name']}"/>
               <p:spacer width="10" />
               <p:inputText id="name" value="#{neighborhood.current.name}"/>
               
               <h:outputLabel value="#{msg['neighborhood.register.label.state']}"/>
               <p:spacer width="10" />
               <p:selectOneMenu id="state" 
                     value="#{neighborhood.current.state}">
                  <f:selectItems value="#{neighborhood.stateItems}" />
               </p:selectOneMenu>
               
               <h:outputLabel value="#{msg['neighborhood.register.label.acronym']}"/>
               <p:spacer width="10" />
			   <p:inputText id="acronym" value="#{neighborhood.current.acronym}"/>
               
               
               <h:outputLabel value="#{msg['neighborhood.register.label.city']}"/>
               <p:spacer width="10" />
               <h:panelGroup layout="block">
                  <p:inputText id="city" readonly="true" 
                     value="#{neighborhood.current.city}"/>
                  <p:commandButton icon="ui-icon-search" 
                        title="#{msg['crud.search']}"
                        onclick="dlgSearchNeighborhood.show();"/>               
               </h:panelGroup>
            </h:panelGrid>
            
            <p:spacer height="15" />
            <br/>
            
            <p:commandButton id="save" 
               value="#{msg['crud.save']}"
               update="@form" process="@form" action="#{neighborhood.save}" />
               
            <p:commandButton id="cancel"
               value="#{msg['crud.cancel']}"
               async="true" update="crud" immediate="true" />
         </p:panel>
         
         <p:spacer height="15" />
            
        <p:panel id="panelSearch" header="#{msg['neighborhood.list.title']}">
               <our:neighborhoodTable enableSearch="true" />
            </p:panel> 
         <p:dialog widgetVar="dlgSearchNeighborhood" 
            width="600" height="550"
            header="#{msg['city.list.title']}" closable="true"
            modal="true" resizable="false">
            
            <p:ajax update="city" event="close" />
            
            <our:cityTable id="cityList" renderSelect="true"
               renderEdit="false" renderRemove="false"
               enableSearch="true" widthActionColumn="90px"
               value="#{neighborhood.current.city}" />            
         </p:dialog>
      </h:form>
      
   </ui:define>   		
	</ui:composition>
</html>
